<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/8/21
  Time: 0:27
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户列表</title>
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>

<%-- boostrap主容器 --%>
<div class="container">

    <%-- 页面标题 --%>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>用户列表</h1>
            </div>
        </div>
    </div>
    <%-- 页面标题 --%>

    <div class="row">
        <div class="col-md-4 column">
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/User/toAddUser">增加用户</a>
        </div>
    </div>

    <%-- 表格展示区域 --%>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">

                <%-- 表头 --%>
                <thead>
                <tr>
                    <th>用户名</th>
                    <th>密码</th>
                    <th>操作</th>
                </tr>
                </thead>
                <%-- 表头 --%>

                <%-- 表身 --%>
                <tbody>
                <c:forEach var="users" items="${requestScope.get('list')}">
                    <tr>
                        <td>${users.username}</td>
                        <td>${users.password}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/User/toUpdate?username=${users.username}">修改</a>
                            &nbsp; | &nbsp;
                            <a href="${pageContext.request.contextPath}/User/deleteUser?username=${users.username}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
                <%-- 表身 --%>

            </table>
            <p>一共${page.pages}页</p>
            <a href="${pageContext.request.contextPath}/User/allUser?page=1">第一页</a>
            <a href="${pageContext.request.contextPath}/User/allUser?page=
<c:if test="${page.prePage == 0}">1</c:if>
<c:if test="${page.prePage != 0}">${page.prePage}</c:if>">上一页</a>
            <a href="${pageContext.request.contextPath}/User/allUser?page=
<c:if test="${page.nextPage == 0}">${page.pages}</c:if>
<c:if test="${page.nextPage != 0}">${page.nextPage}</c:if>">下一页</a>
            <a href="${pageContext.request.contextPath}/User/allUser?page=${page.pages}">最后页</a>

        </div>
    </div>
    <%-- 表格展示区域 --%>

</div>
<%-- boostrap主容器 --%>
</body>
</html>
